﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPageAdmin.Master" AutoEventWireup="true"
    CodeBehind="UserManager.aspx.cs" Inherits="DesignLife.Admin.UserManager" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link rel="stylesheet" type="text/css" href="css/table.css"/>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div style="width: 1024px">
        <div style="float: left; width: 60%">
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:GridView ID="gvUser" runat="server" AutoGenerateColumns="false" EnableModelValidation="True"
                        OnSelectedIndexChanged="gvUser_SelectedIndexChanged">
                        <Columns>
                            <asp:BoundField DataField="UserID" HeaderText="ID" />
                            <asp:BoundField DataField="Username" HeaderText="Username" />
                            <asp:BoundField DataField="Fullname" HeaderText="Full name" />
                            <asp:BoundField DataField="Email" HeaderText="Email" />
                            <asp:BoundField DataField="Phone" HeaderText="Phone" />
                            <asp:BoundField DataField="RoleName" HeaderText="Role Name" />
                            <asp:BoundField DataField="Status" HeaderText="Status" />
                            <asp:ButtonField ButtonType="Button" Text="Edit" CommandName="select" />
                        </Columns>
                    </asp:GridView>
                    <br>
                    <table>
                        <tr>
                            <td>
                                <asp:Label ID="Label1" runat="server" Text="Username: "></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtUsername" runat="server" ValidationGroup="User"></asp:TextBox>
                            </td>
                            <td>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                    ControlToValidate="txtPhone" ErrorMessage="User must Required" 
                                    ValidationGroup="User"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label2" runat="server" Text="Password: "></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtPassword" runat="server" TextMode="Password" 
                                    ValidationGroup="User"></asp:TextBox>
                            </td>
                            <td>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                    ControlToValidate="txtPassword" ErrorMessage="Password must Required" 
                                    ValidationGroup="User"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label3" runat="server" Text="Fullname: "></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtFullname" runat="server" ValidationGroup="User"></asp:TextBox>
                            </td>
                            <td>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                                    ControlToValidate="txtFullname" ErrorMessage="Fullname must Required" 
                                    ValidationGroup="User"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label4" runat="server" Text="Email: "></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtEmail" runat="server" ValidationGroup="User"></asp:TextBox>
                            </td>
                            <td>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                    ControlToValidate="txtEmail" ErrorMessage="Error Validate" 
                                    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
                                    ValidationGroup="User"></asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label5" runat="server" Text="Phone"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtPhone" runat="server" ValidationGroup="User"></asp:TextBox>
                            </td>
                            <td>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                                    ControlToValidate="txtPhone" ErrorMessage="RegularExpressionValidator" 
                                    ValidationExpression="0{1}[0-9]{1,10}" ValidationGroup="User"></asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label6" runat="server" Text="Role: "></asp:Label>
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlRole" runat="server" ValidationGroup="User">
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label7" runat="server" Text="Status:"></asp:Label>
                            </td>
                            <td>
                                <asp:CheckBox ID="ckbStatus" runat="server" ValidationGroup="User" Enabled="False" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Button ID="btnSubmit" runat="server" onclick="btnSubmit_Click" 
                                    Text="Submit" ValidationGroup="User" />
                            </td>
                        </tr>
                    </table>
                    <br>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnSubmit"/>
                </Triggers>
            </asp:UpdatePanel>
        </div>
        <div style="float: left; width: 40%">
            <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                <ContentTemplate>
                    <asp:GridView ID="gvRole" runat="server" AutoGenerateColumns="false" 
                        EnableModelValidation="True" 
                        onselectedindexchanged="gvRole_SelectedIndexChanged">
                        <Columns>
                            <asp:BoundField DataField="RoleID" HeaderText="ID" />
                            <asp:BoundField DataField="RoleName" HeaderText="RoleName" />
                            <asp:BoundField DataField="Status" HeaderText="Status" />
                            <asp:ButtonField ButtonType="Button" Text="Edit" CommandName="select" />
                        </Columns>
                    </asp:GridView>
                    <br></br>
                    <asp:Label ID="Label8" runat="server" Text="Role Name: "></asp:Label>
                    <asp:TextBox ID="txtRoleName" runat="server" ValidationGroup="Role"></asp:TextBox>
                    <br></br>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                        ControlToValidate="txtRoleName" ErrorMessage="Role Name must required" 
                        ValidationGroup="Role"></asp:RequiredFieldValidator>
                    <br></br>
                    <asp:Label ID="Label9" runat="server" Text="Status"></asp:Label>
                    <asp:CheckBox ID="ckbRole" runat="server" ValidationGroup="Role" />
                    <br></br>
                    <asp:Button ID="btnSubmitRole" runat="server" onclick="btnSubmitRole_Click" 
                        Text="Submit" ValidationGroup="Role" />
                    <br></br>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger runat="server" ControlID="btnSubmitRole"/>
                </Triggers>
            </asp:UpdatePanel>
        </div>
    </div>
</asp:Content>
